public class User {
    private String id;
    private String name;
    private String avatarUrl;

    // 构造方法、getter 和 setter 等
    public User() {}

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }
}

public class UserModel {

    // 模拟获取用户信息的操作
    public User getUserInfo() {
        User user = new User();
        user.setName("张三");
        user.setAvatarUrl("http://example.com/avatar.jpg");
        return user;
    }
}

public interface UserView {

    void onUserInfoSuccess(User user);

    void onUserInfoFailure(String error);
}

public class UserPresenter {

    private UserModel userModel;
    private UserView userView;

    public UserPresenter(UserModel userModel, UserView userView) {
        this.userModel = userModel;
        this.userView = userView;
    }

    public void getUserInfo() {
        try {
            User user = userModel.getUserInfo();
            userView.onUserInfoSuccess(user);
        } catch (Exception e) {
            userView.onUserInfoFailure("获取用户信息出错");
        }
    }
}

public class MainActivity extends AppCompatActivity implements UserView {

    private UserPresenter userPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        UserModel userModel = new UserModel();
        userPresenter = new UserPresenter(userModel, this);
    }

    public void onGetUserInfoButtonClicked(View view) {
        userPresenter.getUserInfo();
    }

    @Override
    public void onUserInfoSuccess(User user) {
        Toast.makeText(this, "用户姓名: " + user.getName() + ", 头像地址: " + user.getAvatarUrl(), Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onUserInfoFailure(String error) {
        Toast.makeText(this, error, Toast.LENGTH_SHORT).show();
    }
}